package myStruts;



public class testAction extends deafaultAction {

	public String execute() throws Exception {
		this.LOG.info("username: " + this.getUsername());
		this.LOG.info("password: " + this.getPassword());
		String nextpage;
		if (this.getUsername() == null && this.getPassword() == null) {
			this.setMsg("Welcome!");
			nextpage="login";
		}else if("tom".equals(this.getUsername())&& "cat".equals(this.getPassword())){
			nextpage="success";
		}else{
			this.setMsg("id/pw incorrect!");
			nextpage="login";			
		}
		
		
		return nextpage;
	}

	String username;
	String password;
	String msg;

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

}
